function slidePage() {

	if (document.getElementById("shareSheet").style.visibility=="visible"){
			
		document.getElementById("shareSheet").style.webkitTransform="translateX(150%)";
				
			document.getElementById("shareSheet").style.MozTransform="translateX(150%)";
		
			document.getElementById("shareSheet").style.OTransform="translateX(150%)";
		
		setTimeout(function() {
		
			document.getElementById("shareSheet").style.visibility= "hidden";
				
			document.getElementById("page").style.webkitTransform="translateY(0px)";
			
				document.getElementById("page").style.MozTransform="translateY(0px)";
	
				document.getElementById("page").style.OTransform="translateY(0px)";
			
			setTimeout(function(){ slidePage(); }, 500);
				
		}, 600);
	}
	else if (document.getElementById("mainMenu").style.display=="block"){
	
		$(document).ready(function() {$("#fadeOut").fadeTo("slow", "1");});
	
		document.getElementById("mainMenu").style.zIndex= "-1";
		
		document.getElementById("subMenu").style.zIndex= "-1";
	
		document.getElementById("menuButton").style.webkitTransform = "rotateZ(0deg)";
		
			document.getElementById("menuButton").style.MozTransform = "rotateZ(0deg)";
		
			document.getElementById("menuButton").style.OTransform = "rotateZ(0deg)";
		
		document.getElementById("page").style.MozTransform="translateX(0px)";
		
			document.getElementById("page").style.webkitTransform="translateX(0px)";
		
			document.getElementById("page").style.OTransform="translateX(0px)";
		
		setTimeout(function() {
			
			document.getElementById("slideGrip").style.width = "20px";
		
			document.getElementById("mainMenu").style.display= "none";
		
			document.getElementById("subMenu").style.display= "none";
		
			$(document).ready(function() {$(".subMenuButtons").css("display", "none");});
					
		}, 600);
	}
	else {
		
		$(document).ready(function() {$("#fadeOut").fadeTo("slow", ".4");});
	
		document.getElementById("menuButton").style.webkitTransform = "rotateZ(-90deg)";
		
		document.getElementById("menuButton").style.MozTransform = "rotateZ(-90deg)";
		
		document.getElementById("menuButton").style.OTransform = "rotateZ(-90deg)";
		
		document.getElementById("mainMenu").style.display= "block";
		
		document.getElementById("page").style.webkitTransform="translateX(174px)";
		
			document.getElementById("page").style.MozTransform="translateX(174px)";
			
			document.getElementById("page").style.OTransform="translateX(174px)";
	
		setTimeout(function() {
		
			document.getElementById("mainMenu").style.zIndex= "1";
			
			document.getElementById("slideGrip").style.width = "100px";
		
		}, 600);
	}
}



function slideSubMenu(newSubMenu) {
	
	if (document.getElementById("subMenu").style.display == "block"){
		
		document.getElementById("subMenu").style.zIndex = "-1";
		
		document.getElementById("page").style.webkitTransform="translateX(174px)";
		
			document.getElementById("page").style.MozTransform="translateX(174px)";
		
			document.getElementById("page").style.OTransform="translateX(174px)";
		
		setTimeout(function() {
						
			$(document).ready(function() {$(".subMenuButtons").css("display", "none");});
						
			document.getElementById(newSubMenu).style.display = "block";
			
			document.getElementById(newSubMenu).style.marginLeft = "0px";
					
			setTimeout(function() {
						
				document.getElementById("page").style.webkitTransform="translateX(286px)";
					
					document.getElementById("page").style.MozTransform="translateX(286px)";
		
					document.getElementById("page").style.OTransform="translateX(286px)";
					
				setTimeout(function(){
					
					document.getElementById("subMenu").style.zIndex="1";
					
				}, 500);
				
				}, 100);
		}, 500); 
	}
		
	else {
		
		document.getElementById("subMenu").style.display = "block";
		
		document.getElementById(newSubMenu).style.display="block";
		
		document.getElementById("page").style.webkitTransform="translateX(286px)";
						
			document.getElementById("page").style.MozTransform="translateX(286px)";
						
			document.getElementById("page").style.OTransform="translateX(286px)";
				
		setTimeout(function() {
					
			document.getElementById("subMenu").style.zIndex = "1";
			
		}, 700);
	}
}

function closeMenus() {
	
	if (document.getElementById("mainMenu").style.display=="block"){
	
		$(document).ready(function() {$("#fadeOut").fadeTo("slow", "1");});
	
		document.getElementById("subMenu").style.zIndex = "-1";
		
		document.getElementById("mainMenu").style.zIndex = "-1";
	
		document.getElementById("menuButton").style.webkitTransform = "rotateZ(0deg)";
		
			document.getElementById("menuButton").style.MozTransform = "rotateZ(0deg)";
	
			document.getElementById("menuButton").style.OTransform = "rotateZ(0deg)";
		
		document.getElementById("page").style.webkitTransform="translateX(0px)";
				
			document.getElementById("page").style.MozTransform="translateX(0px)";
				
			document.getElementById("page").style.OTransform="translateX(0px)";
		
		setTimeout(function() {
		
			document.getElementById("mainMenu").style.display= "none";
		
			document.getElementById("subMenu").style.display= "none";
		
			$(document).ready(function() {$(".subMenuButtons").css("display", "none");});
			
		;}, 500);
	}
	else if (document.getElementById("shareSheet").style.visibility=="visible"){
			
		document.getElementById("shareSheet").style.webkitTransform="translateX(150%)";
				
			document.getElementById("shareSheet").style.MozTransform="translateX(150%)";
		
			document.getElementById("shareSheet").style.OTransform="translateX(150%)";
		
		setTimeout(function() {
		
			document.getElementById("shareSheet").style.visibility= "hidden";
			
			document.getElementById("page").style.webkitTransform="translateY(0px)";
		
				document.getElementById("page").style.MozTransform="translateY(0px)";
			
				document.getElementById("page").style.OTransform="translateY(0px)";

				
		}, 1100);
	}
}

function slideShareSheet() {

	if (document.getElementById("shareSheet").style.visibility=="visible"){
			
		document.getElementById("shareSheet").style.webkitTransform="translateX(150%)";
				
			document.getElementById("shareSheet").style.MozTransform="translateX(150%)";
		
			document.getElementById("shareSheet").style.OTransform="translateX(150%)";
		
		setTimeout(function() {
		
			document.getElementById("shareSheet").style.visibility= "hidden";
			
			document.getElementById("page").style.webkitTransform="translateY(0px)";
		
				document.getElementById("page").style.MozTransform="translateY(0px)";
			
				document.getElementById("page").style.OTransform="translateY(0px)";

				
		}, 1100);
	}
	else {
		
		document.getElementById("page").style.webkitTransform="translateY(100px)";
		
			document.getElementById("page").style.MozTransform="translateY(100px)";
			
			document.getElementById("page").style.OTransform="translateY(100px)";
			
			document.getElementById("shareSheet").style.visibility= "visible";
	
		setTimeout(function() {
			
			document.getElementById("shareSheet").style.webkitTransform="translateX(0%)";
				
				document.getElementById("shareSheet").style.MozTransform="translateX(0%)";
		
				document.getElementById("shareSheet").style.OTransform="translateX(0%)";
		
		}, 500);
	}
}
